﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDIOrganizer
{
    public interface IModifiable
    {        
        bool Modified
        {
            get;
            set;
        }
                
        event Sheet.OnModifiedChangedEventHandler OnModifiedChanged;
        
        /// <summary>
        /// Is it okay to leave and move on? Have the changes been saved (or has the user accepted discarding them?)
        /// </summary>
        /// <see>
        /// OKLeaving
        /// </see>
        
        event Sheet.OnLeavingModifiedEntityEventHandler OnLeavingModifiedEntity;

        /// <summary>
        /// Is it okay to leave and move on? Have the changes been saved (or has the user accepted discarding them?)
        /// </summary>
        /// <remarks>
        /// Referring to this method makes assigning an event handler to OnLeavingModifiedEntity optional -
        /// if the event is null, the method will detect it. Otherwise we'd get an exception.
        /// 
        /// This method should also react if Modified is false, and return false in such case
        /// (if there have been no modifications, there is no point in asking user whether they care to save the data -
        /// and triggering the event is not necessary at all).
        /// </remarks>        
        /// <seealso cref="OnLeavingModifiedEntity"/>
        bool OKLeaving();
    }
}
